import { alova } from '@/service/request';

/** get StorageFile page */
export function paginateStorageFile(params?: Api.SearchParams) {
  return alova.Get<Api.PageRow>('/infra/storage/storageFile/paginate', {
    params
  });
}

/** get all StorageFile */
export function listStorageFile() {
  return alova.Get<Api.Row[]>('/infra/storage/storageFile/list');
}

/** create StorageFile */
export function createStorageFile(data?: Api.Model) {
  return alova.Post<boolean>('/infra/storage/storageFile/create', data);
}

/** update StorageFile */
export function updateStorageFile(data?: Api.Model) {
  return alova.Post<boolean>('/infra/storage/storageFile/update', data);
}

/** delete StorageFile */
export function deleteStorageFile(params: Api.DeleteParams) {
  return alova.Post<boolean>('/infra/storage/storageFile/delete', undefined, { params });
}

/** delete StorageFile */
export function batchDelStorageFile(params: Api.BatchDeleteParams) {
  return alova.Post<boolean>('/infra/storage/storageFile/batchDel', undefined, { params });
}

export function uploadFile(configId: number, file: File) {
  return alova.Post<Api.Model>('/infra/storage/storageFile/uploadFile', { configId, file });
}
